<template>
	<view class="discount_coupon">
		<view class="discount_left">
			<view class="vip">
				会员专享
			</view>
			<view class="discount_money" v-if="item.discountType==3  || item.verificationCode!=null">
				<text>商品券</text>
			</view>
			<view class="discount_money" v-else>
				<text>￥</text>{{ item.maxDiscountAmount}}
			</view>
			<view class="condition" v-if="item.discountType!=3 && item.verificationCode==null">
				{{item.thresholdAmount ==0?'无门槛':`满${item.thresholdAmount}元可用`}}
			</view>
		</view>
		<view class="discount_line">

		</view>
		<view class="discount_right">
			<view class="discount_name">
				<text>{{item.name}}</text>
				<view class="get_discount use" v-if="get_status==0&&item.status==1" @click="sendId(item.id)">
					立即使用</view>
				<view class="get_discount use" v-else-if="get_status==0&&item.status==2">已使用</view>
				<view class="get_discount use" v-else-if="get_status==0&&item.status==3">已失效</view>
				<view class="get_discount" @click="sendId(item.id)" v-else>领取</view>
			</view>
			<view class="time">
				{{item.termBeginTime}} - {{item.termEndTime}}
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "discount-coupon",
		data() {
			return {

			};
		},
		props: ['get_status', 'item', 'index'],
		methods: {
			navigateTo(url) {
				uni.navigateTo({
					url
				})
			},
			sendId(id) {
				this.$emit('getCou', {
					id,
					index: this.index
				})
			}
		}
	}
</script>

<style lang="scss">
	.discount_coupon {
		width: 694rpx;
		height: 196rpx;
		background: #FDF5F6;
		border-radius: 10rpx;
		overflow: hidden;
		position: relative;
		display: flex;

		.vip {
			width: 130rpx;
			height: 36rpx;
			background: #FDF5F6;
			font-size: 20rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			line-height: 36rpx;
			color: #FD3653;
			text-align: center;
			position: absolute;
			left: 0;
			top: 0;
			background-image: linear-gradient(to right, #FDD59F, #fdefe7);
		}

		.discount_left {
			padding: 50rpx 0 0;
			color: #FD3653;
			box-sizing: border-box;
			width: 200rpx;
			text-align: center;

			.discount_money {
				font-size: 55rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: bold;
				color: #FD3653;

				text {
					font-size: 28rpx;

				}
			}

			.condition {
				font-size: 24rpx;
				font-weight: 400;
				padding-top: 16rpx;
				color: #FD3653;
			}
		}

		.discount_line {
			width: 0rpx;
			margin-top: 30rpx;
			height: 136rpx;
			border-left: 1rpx dotted #F9A5B1;
		}

		.discount_right {
			padding: 36rpx 0 0 40rpx;

			.discount_name {
				display: flex;

				text {
					width: 236rpx;
					height: 86rpx;
					font-size: 32rpx;
					overflow: hidden;
					font-weight: bold;
					text-overflow: ellipsis;
					color: #222222;
					display: -webkit-box;
					-webkit-box-orient: vertical;
					-webkit-line-clamp: 2;
				}

				.get_discount {
					width: 160rpx;
					height: 44rpx;
					background: #FF594D;
					border-radius: 58rpx 58rpx 58rpx 58rpx;
					font-size: 20rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 500;
					color: #FFFFFF;
					text-align: center;
					line-height: 44rpx;
					margin-top: 40rpx;
					margin-left: 30rpx;

					&.use {
						box-sizing: border-box;
						border: 2rpx solid #FF594D;
						color: #FF594D;
						background-color: transparent;
					}
				}
			}

			.time {
				font-size: 20rpx;
				font-family: PingFang SC, PingFang SC;
				font-weight: 400;
				color: #666666;
				padding-top: 9rpx;
			}
		}
	}
</style>